<template>
  <div class="apply">
    <Navigation :logoName="logoName" :routeInfo="routeInfo"></Navigation>
    <div class="formContent">
      <div class="show">
         <h2>应诉通知书</h2>
         <div class="notifyContent">
                  <div>
                    <p class="titleDirector">申请人：</p>
                    <div v-for="(item,index) in infos.appList" :key="index">
                        <div v-if="item.type==1||item.type==2" class="singleInfo">
                          <p class="info">姓名：<span>{{item&&item.name}}</span></p>
                          <p class="info">身份证号：<span>{{item&&item.idCard}}</span></p>
                        </div>
                        <div v-else class="singleInfo">
                          <p class="info">公司名称：<span>{{item&&item.companyName}}</span></p>
                          <p class="info">机构代码：<span>{{item&&item.orgCode}}</span></p>
                        </div>
                    </div>
                    
                  </div>
                  <div>
                    <p class="titleDirector">被申请人：</p>
                    <div v-for="(item,index) in infos.resList" :key="index">
                        <div v-if="item.type==4||item.type==5" class="singleInfo">
                          <p class="info">姓名：<span>{{item&&item.name}}</span></p>
                          <p class="info">身份证号：<span>{{item&&item.idCard}}</span></p>
                        </div>
                        <div class="singleInfo" v-else>
                          <p class="info">公司名称：<span>{{item&&item.companyName}}</span></p>
                          <p class="info">机构代码：<span>{{item&&item.orgCode}}</span></p>
                        </div>
                    </div>
                  </div>
                  <div>
                    <p class="titleDirector">第三人：</p>
                    <div v-for="(item,index) in infos.dsfList" :key="index">
                        <div class="singleInfo" v-if="item.type==7||item.type==8">
                          <p class="info">姓名：<span>{{item&&item.name}}</span></p>
                          <p class="info">身份证号：<span>{{item&&item.idCard}}</span></p>
                        </div>
                        <div class="singleInfo" v-else>
                          <p class="info">公司名称：<span>{{item&&item.companyName}}</span></p>
                          <p class="info">机构代码：<span>{{item&&item.orgCode}}</span></p>
                        </div>
                    </div>
                  </div>
                  <div>
                    <p class="titleDirector">正文：</p>
                    <p class="content">{{infos&&infos.content}}</p>
                  </div>
          </div>
         <div class="btn-sty">
          <span class="btn btn-apply" @click="back">返回</span>
          <span class="btn btn-complete" @click="create">生成</span>
        </div>
      </div>
      
    </div>
    
  </div>
</template>

<script>
import Navigation from '../common/navigation';
import {Spin} from 'view-design';
export default {
  name: 'VerifydirectorCreateApply',
  data(){
     return {
        logoName:'生成应诉申请书',
        routeInfo:'首页/仲裁审核受理/生成应诉申请书',
        infos:{}
     }
  },
  props: {
    msg: String
  },
  methods:{
    back(){
      this.$router.push('/Syspage/VerifydirectorIndex')
    },
    create(){
        Spin.show({
            render: (h) => {
                return h('div', [
                    h('Icon', {
                        'class': 'demo-spin-icon-load',
                        props: {
                            type: 'ios-loading',
                            size: 60
                        }
                    }),
                    h('div', 'Loading')
                ])
            }
        });
        this.$http.post('/api'+this.urls.applyArbitration,{
          "caseNo":this.$route.params.caseno,
          "type":7
          // "appEmail":'443250191@qq.com',
          // "resEmail":'443250191@qq.com'
          // "appEmail":this.infos&&this.infos.appEmail,
          // "resEmail":this.infos&&this.infos.resEmail
        }).then((result)=>{
            if(result.data.code==200){
              this.$Message.success('生成应诉通知书并邮件发送成功');
              Spin.hide()
              this.$router.push('/Syspage/VerifydirectorIndex');
            }else{
                this.$Spin.hide();
                this.$Message.warning('网络错误');
              }
        }) 
    },
    detail(){
      this.$http.post('/api'+this.urls.getCaseDetail,{caseNo:this.$route.params.caseno}).then((result)=>{
          if(result.data.code==200){
            this.infos=result.data.data
          }else{
                this.$Message.warning('网络错误');
              }
      })
      // this.$http.post('/api'+this.urls.getWordDetail,{caseNo:this.$route.params.caseno}).then((result)=>{
      //       if(result.data.code==200){
      //          this.infos=result.data.data.detail;
      //       }
      // }) 
    },
    handleSubmit () {
      
    }
  },
  components:{Navigation},
  created(){
    this.detail()
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .show{
    margin: 0 auto;
    width: 750px;
    color: #333333;
  }
  h2{
    color:#000;
    text-align: center;
    height: 70px;
    line-height: 70px;
  }
  .singleInfo{
    margin: 10px 20px;
    border-bottom: 1px solid #e6e6e6;
  }
  .info{
    margin-left: 30px;
  }
  .notifyContent{
    height: 582px;
    overflow-y: auto;
  }
  .titleDirector{
    height: 32px;
    line-height: 32px;
    margin-top: 16px;
  }
  .content{
    text-indent:2em;
  }
  .btn-sty{
    text-align: center;
    margin-top: 20px;
  }
</style>
